package com.whz.eq;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: hong-zhi
 * @Description:
 * @Date: Create in 16:54 2021/4/30
 * @Modified By:
 */
@Slf4j
public class SmellPoint extends Point {
    private final String smell;
    public SmellPoint(int x, int y, String smell) {
        super(x, y);
        this.smell = smell;
    }

    @Override
    public boolean equals(Object o) {
        log.info("SmellPoint.o.getClass() : {}", o.getClass());
        if(!(o instanceof Point)) {
            log.info("SmellPoint.o instanceof Point");
            return false;
        }
        if (!(o instanceof SmellPoint)) {
            log.info("SmellPoint.o instanceof SmellPoint");
            return o.equals(this);
        }
        SmellPoint that = (SmellPoint) o;
        return super.equals(o) && StringUtils.equals(this.smell, that.smell);
    }
}
